﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.ComponentModel;

namespace AGameOfThrones.game
{
    public class position : INotifyPropertyChanged, stream.streamable
    {
        private String panel = "";
        public String Panel
        {
            get { return panel; }
            set
            {
                if (panel != value)
                {
                    panel = value;
                    Notify("Panel");
                }
            }
        }

        private double x = 0;
        public double X
        {
            get { return x; }
            set
            {
                if (x != value)
                {
                    x = value;
                    Notify("X");
                }
            }
        }

        private double y = 0;
        public double Y
        {
            get { return y; }
            set
            {
                if (y != value)
                {
                    y = value;
                    Notify("Y");
                }
            }
        }



        public event PropertyChangedEventHandler PropertyChanged;
        protected void Notify(string property)
        {
            if (this.PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }

        public virtual void serialize(stream.stream io_Stream)
        {
            io_Stream.begin("Position")
                .serialize("Panel", ref panel)
                .serialize("X", ref x)
                .serialize("Y", ref y)
            .end();
        }
    }
}
